import {FeatureInterface, getTool} from "ctool-config";

export type CustomAction = {
    type: "regex" | "text" | "key"
    regex?: string
    text?: string
    key?: string
}
export const customActions = new Map<FeatureInterface, CustomAction[]>()

customActions.set(
    getTool('time').getFeature('timestamp'),
    [
        {
            "type": "regex",
            "regex": "/(^\\d{5,}$)|(^\\d{4}-\\d{2}-\\d{2} \\d{2}:\\d{2}:\\d{2}(?:\\.\\d{3})?$)/i",
        }
    ]
)

customActions.set(
    getTool('qrCode').getFeature('generate'),
    [
        {
            "type": "regex",
            "regex": "/^https?:\\/\\//i",
        }
    ]
)

customActions.set(
    getTool('ip').firstFeature(),
    [
        {
            "type": "regex",
            "regex": "/\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}/i",
        }
    ]
)

customActions.set(
    getTool('unicode').getFeature('decoder'),
    [
        {
            "type": "regex",
            "regex": "/\\\\u[0-9a-f]{4}/i",
        }
    ]
)

